package org.giovanolli.mumi.service.impl;

import java.util.Date;

import org.giovanolli.mumi.dao.Dao;
import org.giovanolli.mumi.dao.PatientLogDao;
import org.giovanolli.mumi.entities.PatientLog;
import org.giovanolli.mumi.service.PatientLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * The Class PatientLogServiceImpl.
 */
@Service("patientLogService")
public class PatientLogServiceImpl extends AbstractService<PatientLog> implements PatientLogService {

	/** The patientLog dao. */
	@Autowired
	private PatientLogDao patientLogDao;

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.giovanolli.mumi.service.BaseObjectService#getServiceDao()
	 */
	protected Dao<PatientLog> getServiceDao() {
		return patientLogDao;
	}

	@Override
	public void saveEntity(PatientLog entity) {
		if (entity.getDate() == null) {
			entity.setDate(new Date());
		}
		super.saveEntity(entity);
	}

}
